package com.sgb.kjwl.viewmodel.self.publish;

import com.sgb.kjwl.model.entity.user.GetSkuEntity1;
import com.swgk.core.base.api.ICallBack;
import com.sgb.kjwl.api.NewAPIManager;
import com.sgb.kjwl.repository.SelfRepertory;
import com.sgb.kjwl.view.ui.activity.self.publish.GoodsSpecActivity;
import com.swgk.core.base.BaseViewModel;
import com.swgk.core.base.model.entity.BaseEntity;
import com.swgk.core.dialog.DialogHelper;

import java.util.List;

public class GoodsSpecModel extends BaseViewModel {
    private GoodsSpecActivity activity;
    private SelfRepertory repertory;

    public GoodsSpecModel(GoodsSpecActivity activity, SelfRepertory repertory) {
        this.activity = activity;
        this.repertory = repertory;
    }

    //获取是否可以填写规格
    public void getSku(String cid3) {
        DialogHelper.showProgressDialog(activity, null, "数据加载中...", 0, false, null).setCanceledOnTouchOutside(false);
        NewAPIManager.getInstance().getGoodsReleasedAPI().getSku(Long.parseLong(cid3)).enqueue(new ICallBack<BaseEntity<List<GetSkuEntity1>>>() {
            @Override
            public void onSuccess(BaseEntity<List<GetSkuEntity1>> data) {
                activity.isSku(data.getData());
            }
        });
    }
}
